#include <err.h>
#include <string.h>
#include <unistd.h>

#include "util.h"

size_t
estrnlen(const char *s, size_t maxlen)
{
	size_t res;

	res = strnlen(s, maxlen);
	if (res >= maxlen)
		errx(5, "line was truncated");

	return res;
}
